//
//  ZM_YYLabImg_CVCell.m
//  YYFMMall
//
//  Created by chenzm on 2019/9/4.
//  Copyright © 2019 YuYou1. All rights reserved.
//

#import "ZM_YYLabImg_CVCell.h"


@interface ZM_YYLabImg_CVCell()



@end


@implementation ZM_YYLabImg_CVCell

#pragma mark - 赋值


#pragma mark -Methods
-(void)setTextStr:(NSString *)textStr{
    _textStr = textStr;
    self.yyLbl.text = kIsEmptyStr(textStr)?@"":textStr;
}

-(void)setMattStr:(NSMutableAttributedString *)mattStr{
    _mattStr = mattStr;
    self.yyLbl.attributedText = mattStr;
}

-(void)setImgUrl:(NSString *)imgUrl{
    _imgUrl = imgUrl;
    if ([imgUrl containsString:@"http"]) {
        [self.imgV sd_setImageWithURL:kURL(imgUrl) placeholderImage:kImage(kDefBlankIcon)];
    }else{
        self.imgV.image = kImage(imgUrl);
    }
}



#pragma mark - Intial
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super initWithCoder: aDecoder]) {
        [self setUpBaseData];
        [self setUpUI];
    }
    return self;
}

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setUpBaseData];
        [self setUpUI];
    }
    return self;
}

///基本数据配置
-(void)setUpBaseData{
    
}

///控件添加
-(void)setUpUI{
    [self imgV];
    [self yyLbl];
    [self lineV];
}

#pragma mark - 布局
-(void)layoutSubviews{
    [super layoutSubviews];
    
}

#pragma mark - lazyload
-(UIImageView *)imgV{
    if (!_imgV) {
        _imgV = [UIImageView new];
        _imgV.contentMode = UIViewContentModeScaleAspectFill;
        [self addSubview:_imgV];
        [_imgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self);
            make.right.mas_equalTo(self).offset(-15);
        }];
    }
    return _imgV;
}



-(YYLabel *)yyLbl{
    if (!_yyLbl) {
        _yyLbl = [YYLabel new];
        _yyLbl.textColor = kBlackColor;
        _yyLbl.font = kMediumFont(14);
        [self addSubview:_yyLbl];
        [_yyLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.centerY.mas_equalTo(self);
        }];
    }
    return _yyLbl;
}

-(UIView *) lineV {
    if (!_lineV) {
        _lineV = [UIView new];
        _lineV.backgroundColor = kHexColor(0xEEEEEE);
        _lineV.hidden = YES;
        [self addSubview:_lineV];
        [_lineV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(self);
            make.left.mas_equalTo(15);
            make.right.mas_equalTo(-15);
            make.height.mas_equalTo(0.5);
        }];
    }
    return _lineV;
}

-(void)dealloc{
    
}
@end
